<table id="table-squad" class="table table-condensed tablesorter">
    <thead>
        <tr>
            <th>Lp.</th>
            <td></td>
            <th>Imię</th>
            <th>Nazwisko</th>
            <th>Pozycje</th>
            <th>Numer</th>
            <th>Mecze</th>
            <th>Bramki</th>
            <th>Żółte kartki</th>
            <th>Czerwone kartki</th>
            <?php echo ($admin==1) ? '<td></td>' : ''; ?>
        </tr>
    </thead>
    <tbody>
    <?php
    $i = 1;
    $trener = array();
    foreach($squad as $idx=>$s)
    {        
        if(array_key_exists(9,$s['posit']))
            $trener = $s;
        else
        {
            if(!empty($s['image']))
                $img = base_url($this->config->item('image_user_path').$s['image']);
            else
                $img = place_img(32,32,'4d99e0');
            echo '<tr>'
                .'<td>'.$i.'</td>'
                .'<td><img src="'.$img.'" class="mini-photo thumbnail"/></td>'
                .'<td>'.$s['fname'].'</td>'
                .'<td>'.$s['lname'].'</td>'
                .'<td>';
            $poslen = count($s['posit']);
            $j = 1;
            foreach($s['posit'] as $p)
            {
                if($j==$poslen)
                    echo '<abbr title="'.$p['name'].'"/>'.$p['code'].'</abbr>';
                else
                    echo '<abbr title="'.$p['name'].'"/>'.$p['code'].'</abbr>,&nbsp;';
                $j++;
            }
            echo    '</td>'
                    .'<td>'.$s['number'].'</td>'
                    .'<td></td>'
                    .'<td></td>'
                    .'<td></td>'
                    .'<td></td>';
            if($admin==1)
                echo '<td>'.anchor('team/edit_player/'.$idx,'Edytuj zawodnika',array('class'=>'btn btn-primary btn-mini')).'</td>';
            echo '<tr/>';
            $i++;
        }
    }
    ?>
    </tbody>
    <caption class="label label-info"><strong>Trener drużyny:</strong> <?php echo $trener['fname'].' '.$trener['lname']; ?></caption>
</table>